ts-markdown-builder 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/block.js +1 -1
- package/dist/commonjs/block.js.map +1 -1
- package/dist/commonjs/html.js +8 -2
- package/dist/commonjs/html.js.map +1 -1
- package/dist/commonjs/index.js +9 -3
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/inline.js +0 -2
- package/dist/commonjs/inline.js.map +1 -1
- package/dist/commonjs/join.js +15 -0
- package/dist/commonjs/join.js.map +1 -0
- package/dist/commonjs/table.js.map +1 -1
- package/dist/esm/block.mjs +1 -1
- package/dist/esm/block.mjs.map +1 -1
- package/dist/esm/html.mjs +7 -2
- package/dist/esm/html.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/inline.mjs +0 -1
- package/dist/esm/inline.mjs.map +1 -1
- package/dist/esm/join.mjs +11 -0
- package/dist/esm/join.mjs.map +1 -0
- package/dist/esm/table.mjs.map +1 -1
- package/dist/types/block.d.ts +3 -3
- package/dist/types/html.d.ts +17 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/inline.d.ts +0 -6
- package/dist/types/join.d.ts +14 -0
- package/dist/types/table.d.ts +1 -1
- package/package.json +1 -1
- package/dist/commonjs/join-blocks.js +0 -10
- package/dist/commonjs/join-blocks.js.map +0 -1
- package/dist/esm/join-blocks.mjs +0 -7
- package/dist/esm/join-blocks.mjs.map +0 -1
- package/dist/types/join-blocks.d.ts +0 -7
package/dist/commonjs/block.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.horizontalRule = void 0;
|
|
|
7
7
|
exports.list = list;
|
|
8
8
|
exports.orderedList = orderedList;
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
|
-
const horizontalRule = exports.horizontalRule = '
|
|
10
|
+
const horizontalRule = exports.horizontalRule = '---';
|
|
11
11
|
function heading(text, level = 1) {
|
|
12
12
|
return `${'#'.repeat(level)} ${text}`;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","names":["horizontalRule","exports","heading","text","level","repeat","blockquote","content","prefixLines","codeBlock","list","items","map","item","join","orderedList","index"],"sources":["../../src/block.ts"],"sourcesContent":["import { prefixLines } from './utils';\n\n/**\n * Create a horizontal rule block.\n *\n * Markdown: `---`\n */\nexport const horizontalRule = '
|
|
1
|
+
{"version":3,"file":"block.js","names":["horizontalRule","exports","heading","text","level","repeat","blockquote","content","prefixLines","codeBlock","list","items","map","item","join","orderedList","index"],"sources":["../../src/block.ts"],"sourcesContent":["import { prefixLines } from './utils';\n\n/**\n * Create a horizontal rule block.\n *\n * Markdown: `---`\n */\nexport const horizontalRule = '---';\n\n/**\n * Create a heading block.\n * Markdown: `# Heading`\n *\n * @param text - The text of the heading.\n * @param level - The level of the heading (defaults to 1).\n */\nexport function heading(text: string, level: number = 1): string {\n return `${'#'.repeat(level)} ${text}`;\n}\n\n/**\n * Create a blockquote block.\n *\n * Markdown:\n * ```\n * > Content\n * > Content\n * ```\n *\n * @param text - The content of the blockquote.\n */\nexport function blockquote(content: string): string {\n return prefixLines(content, '> ');\n}\n\n/**\n * Create a code block.\n *\n * Markdown:\n * ````\n * ```\n * Content\n * ```\n * ````\n *\n * @param content - The content of the code block.\n */\nexport function codeBlock(content: string): string {\n return `\\`\\`\\`\\n${content}\\n\\`\\`\\``;\n}\n\n/**\n * Create an unordered list block.\n *\n * Markdown:\n * ```\n * - Item\n * - Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function list(items: readonly string[]): string {\n return items.map((item) => `- ${item}`).join('\\n');\n}\n\n/**\n * Create an ordered list block.\n *\n * Markdown:\n * ```\n * 1. Item\n * 2. Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function orderedList(items: readonly string[]): string {\n return items.map((item, index) => `${index + 1}. ${item}`).join('\\n');\n}\n"],"mappings":";;;;;;;;;AAOO,MAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,KAAK;AAS5B,SAASE,OAAOA,CAACC,IAAY,EAAEC,KAAa,GAAG,CAAC,EAAU;EAC/D,OAAO,GAAG,GAAG,CAACC,MAAM,CAACD,KAAK,CAAC,IAAID,IAAI,EAAE;AACvC;AAaO,SAASG,UAAUA,CAACC,OAAe,EAAU;EAClD,OAAO,IAAAC,kBAAW,EAACD,OAAO,EAAE,IAAI,CAAC;AACnC;AAcO,SAASE,SAASA,CAACF,OAAe,EAAU;EACjD,OAAO,WAAWA,OAAO,UAAU;AACrC;AAaO,SAASG,IAAIA,CAACC,KAAwB,EAAU;EACrD,OAAOA,KAAK,CAACC,GAAG,CAAEC,IAAI,IAAK,KAAKA,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACpD;AAaO,SAASC,WAAWA,CAACJ,KAAwB,EAAU;EAC5D,OAAOA,KAAK,CAACC,GAAG,CAAC,CAACC,IAAI,EAAEG,KAAK,KAAK,GAAGA,KAAK,GAAG,CAAC,KAAKH,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACvE","ignoreList":[]}
|
package/dist/commonjs/html.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.disclosure = disclosure;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
exports.lineBreak = void 0;
|
|
5
|
+
const lineBreak = exports.lineBreak = '<br/>';
|
|
6
|
+
function disclosure(title, content, options) {
|
|
7
|
+
const headerHack = title.startsWith('#') ? '\n\n' : '';
|
|
8
|
+
return `<details${options?.open ? ' open' : ''}>
|
|
9
|
+
<summary>${headerHack}${title}${headerHack}</summary>
|
|
10
|
+
\n${content}\n
|
|
11
|
+
</details>`;
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=html.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","names":["disclosure","title","content"],"sources":["../../src/html.ts"],"sourcesContent":["/**\n * Create a disclosure block.\n *\n * Markdown/Html:\n * ```\n * <details>\n * <summary>Title</summary>\n * Content\n * </details>\n * ```\n *\n * @param title - The title of the disclosure.\n * @param content - The content of the disclosure.\n */\nexport function disclosure(title: string, content: string): string {\n return `<details
|
|
1
|
+
{"version":3,"file":"html.js","names":["lineBreak","exports","disclosure","title","content","options","headerHack","startsWith","open"],"sources":["../../src/html.ts"],"sourcesContent":["/**\n * Create a line break.\n *\n * Markdown/Html:: `<br/>`\n */\nexport const lineBreak = '<br/>';\n\n/**\n * Options for the `disclosure` block.\n */\nexport type DisclosureOptions = {\n /**\n * Whether the disclosure block should be open by default.\n */\n open?: boolean;\n};\n\n/**\n * Create a disclosure block.\n *\n * Markdown/Html:\n * ```\n * <details>\n * <summary>Title</summary>\n * Content\n * </details>\n * ```\n *\n * @param title - The title of the disclosure.\n * @param content - The content of the disclosure.\n * @param options - The options for the disclosure.\n */\nexport function disclosure(title: string, content: string, options?: DisclosureOptions): string {\n // Add extra with lines to render header properly. New line should not be added for regular text\n // as it messes up the formatting.\n const headerHack = title.startsWith('#') ? '\\n\\n' : '';\n\n // The extra new lines in <summary> and <details> are required for proper rendering in GitHub.\n // See https://gist.github.com/scmx/eca72d44afee0113ceb0349dd54a84a2\n return `<details${options?.open ? ' open' : ''}>\n<summary>${headerHack}${title}${headerHack}</summary>\n\\n${content}\\n \n</details>`;\n}\n"],"mappings":";;;;AAKO,MAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,OAAO;AA2BzB,SAASE,UAAUA,CAACC,KAAa,EAAEC,OAAe,EAAEC,OAA2B,EAAU;EAG9F,MAAMC,UAAU,GAAGH,KAAK,CAACI,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,EAAE;EAItD,OAAO,WAAWF,OAAO,EAAEG,IAAI,GAAG,OAAO,GAAG,EAAE;AAChD,WAAWF,UAAU,GAAGH,KAAK,GAAGG,UAAU;AAC1C,IAAIF,OAAO;AACX,WAAW;AACX","ignoreList":[]}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -57,13 +57,19 @@ Object.defineProperty(exports, "italic", {
|
|
|
57
57
|
Object.defineProperty(exports, "joinBlocks", {
|
|
58
58
|
enumerable: true,
|
|
59
59
|
get: function () {
|
|
60
|
-
return
|
|
60
|
+
return _join.joinBlocks;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "joinLines", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () {
|
|
66
|
+
return _join.joinLines;
|
|
61
67
|
}
|
|
62
68
|
});
|
|
63
69
|
Object.defineProperty(exports, "lineBreak", {
|
|
64
70
|
enumerable: true,
|
|
65
71
|
get: function () {
|
|
66
|
-
return
|
|
72
|
+
return _html.lineBreak;
|
|
67
73
|
}
|
|
68
74
|
});
|
|
69
75
|
Object.defineProperty(exports, "link", {
|
|
@@ -90,7 +96,7 @@ Object.defineProperty(exports, "table", {
|
|
|
90
96
|
return _table.table;
|
|
91
97
|
}
|
|
92
98
|
});
|
|
93
|
-
var
|
|
99
|
+
var _join = require("./join.js");
|
|
94
100
|
var _block = require("./block.js");
|
|
95
101
|
var _inline = require("./inline.js");
|
|
96
102
|
var _table = require("./table.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export { joinBlocks } from './join
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export { joinBlocks, joinLines } from './join';\nexport { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from './block';\nexport { code, italic, bold, link, image } from './inline';\nexport { table } from './table';\nexport { lineBreak, disclosure } from './html';\n\nexport type { TableOptions } from './table';\nexport type { DisclosureOptions } from './html';\n"],"mappings":"","ignoreList":[]}
|
package/dist/commonjs/inline.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.js","names":["
|
|
1
|
+
{"version":3,"file":"inline.js","names":["italic","text","bold","code","link","url","image"],"sources":["../../src/inline.ts"],"sourcesContent":["/**\n * Create an italic text.\n *\n * Markdown: `*text*`\n *\n * @param text - The text to be italicized.\n */\nexport function italic(text: string): string {\n return `*${text}*`;\n}\n\n/**\n * Create a bold text.\n *\n * Markdown: `**text**`\n *\n * @param text - The text to be bolded.\n */\nexport function bold(text: string): string {\n return `**${text}**`;\n}\n\n/**\n * Create a code text.\n *\n * Markdown: `\\`text\\``\n *\n * @param text - The text to be marked as code.\n */\nexport function code(text: string): string {\n return `\\`${text}\\``;\n}\n\n/**\n * Create a link or autolink span.\n *\n * Markdown:\n * - `[text](url)` link when `text` is provided\n * - `<url>` autolink when `text` is not provided\n *\n * @param url - The URL to be linked.\n * @param text - The title for the link (optional).\n */\nexport function link(url: string, text?: string): string {\n return text ? `[${text}](${url})` : `<${url}>`;\n}\n\n/**\n * Create an image text.\n *\n * Markdown: ``\n *\n * @param url - The URL of the image.\n * @param text - The description for the image (optional).\n */\nexport function image(url: string, text?: string): string {\n return ``;\n}\n"],"mappings":";;;;;;;AAOO,SAASA,MAAMA,CAACC,IAAY,EAAU;EAC3C,OAAO,IAAIA,IAAI,GAAG;AACpB;AASO,SAASC,IAAIA,CAACD,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AASO,SAASE,IAAIA,CAACF,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AAYO,SAASG,IAAIA,CAACC,GAAW,EAAEJ,IAAa,EAAU;EACvD,OAAOA,IAAI,GAAG,IAAIA,IAAI,KAAKI,GAAG,GAAG,GAAG,IAAIA,GAAG,GAAG;AAChD;AAUO,SAASC,KAAKA,CAACD,GAAW,EAAEJ,IAAa,EAAU;EACxD,OAAO,KAAKA,IAAI,IAAI,EAAE,KAAKI,GAAG,GAAG;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.joinBlocks = joinBlocks;
|
|
4
|
+
exports.joinLines = joinLines;
|
|
5
|
+
var _html = require("./html.js");
|
|
6
|
+
function joinBlocks(blocks) {
|
|
7
|
+
return blocks.filter(Boolean).map(trimBlock).join('\n\n');
|
|
8
|
+
}
|
|
9
|
+
function joinLines(lines) {
|
|
10
|
+
return lines.filter(Boolean).join(_html.lineBreak);
|
|
11
|
+
}
|
|
12
|
+
function trimBlock(block) {
|
|
13
|
+
return block.replace(/^\n+|\n+$/g, '');
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=join.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join.js","names":["joinBlocks","blocks","filter","Boolean","map","trimBlock","join","joinLines","lines","lineBreak","block","replace"],"sources":["../../src/join.ts"],"sourcesContent":["import { lineBreak } from './html';\n\n/**\n * Join blocks of text into a single markdown document (string).\n *\n * @param blocks - The blocks of text to join.\n * @returns Markdown document string.\n */\nexport function joinBlocks(blocks: readonly string[]): string {\n return blocks.filter(Boolean).map(trimBlock).join('\\n\\n');\n}\n\n/**\n * Join lines of text into a single paragraph string with line breaks.\n *\n * @param lines - The lines of text to join.\n * @returns Paragraph string.\n */\nexport function joinLines(lines: string[]) {\n return lines.filter(Boolean).join(lineBreak);\n}\n\nfunction trimBlock(block: string): string {\n return block.replace(/^\\n+|\\n+$/g, '');\n}\n"],"mappings":";;;;;AAQO,SAASA,UAAUA,CAACC,MAAyB,EAAU;EAC5D,OAAOA,MAAM,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,GAAG,CAACC,SAAS,CAAC,CAACC,IAAI,CAAC,MAAM,CAAC;AAC3D;AAQO,SAASC,SAASA,CAACC,KAAe,EAAE;EACzC,OAAOA,KAAK,CAACN,MAAM,CAACC,OAAO,CAAC,CAACG,IAAI,CAACG,eAAS,CAAC;AAC9C;AAEA,SAASJ,SAASA,CAACK,KAAa,EAAU;EACxC,OAAOA,KAAK,CAACC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;AACxC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":["table","header","rows","options","length","map","escapeCellContent","row","widths","compact","getColumnsWidth","separators","_","i","repeat","renderRow","join","index","getColumnWidth","Math","max","paddedCells","cell","padEnd","replace"],"sources":["../../src/table.ts"],"sourcesContent":["export type TableOptions = {\n compact: boolean;\n};\n\nexport function table(header: string[]
|
|
1
|
+
{"version":3,"file":"table.js","names":["table","header","rows","options","length","map","escapeCellContent","row","widths","compact","getColumnsWidth","separators","_","i","repeat","renderRow","join","index","getColumnWidth","Math","max","paddedCells","cell","padEnd","replace"],"sources":["../../src/table.ts"],"sourcesContent":["export type TableOptions = {\n compact: boolean;\n};\n\nexport function table(\n header: readonly string[],\n rows: readonly string[][],\n options?: TableOptions,\n): string {\n if (header.length === 0) {\n return '';\n }\n\n // Escape the header and rows content\n header = header.map(escapeCellContent);\n rows = rows.map((row) => row.map(escapeCellContent));\n\n const widths = !options?.compact ? getColumnsWidth(header, rows) : header.map(() => 1);\n const separators = header.map((_, i) => '-'.repeat(widths[i] ?? 0));\n\n return [\n renderRow(header, widths),\n renderRow(separators, widths),\n ...rows.map((row) => renderRow(row, widths)),\n ].join('\\n');\n}\n\nfunction getColumnsWidth(header: readonly string[], rows: readonly string[][]): number[] {\n return header.map((_, index) => getColumnWidth(header, rows, index));\n}\n\nfunction getColumnWidth(\n header: readonly string[],\n rows: readonly string[][],\n index: number,\n): number {\n return Math.max(header[index]?.length ?? 0, ...rows.map((row) => row[index]?.length ?? 0));\n}\n\nfunction renderRow(row: readonly string[], widths: readonly number[]): string {\n const paddedCells = row.map((cell, index) => cell.padEnd(widths[index] ?? 0));\n return `| ${paddedCells.join(' | ')} |`;\n}\n\nfunction escapeCellContent(cell: string): string {\n return cell.replace(/\\|/g, '\\\\|').replace(/\\n/g, '<br/>');\n}\n"],"mappings":";;;AAIO,SAASA,KAAKA,CACnBC,MAAyB,EACzBC,IAAyB,EACzBC,OAAsB,EACd;EACR,IAAIF,MAAM,CAACG,MAAM,KAAK,CAAC,EAAE;IACvB,OAAO,EAAE;EACX;EAGAH,MAAM,GAAGA,MAAM,CAACI,GAAG,CAACC,iBAAiB,CAAC;EACtCJ,IAAI,GAAGA,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACF,GAAG,CAACC,iBAAiB,CAAC,CAAC;EAEpD,MAAME,MAAM,GAAG,CAACL,OAAO,EAAEM,OAAO,GAAGC,eAAe,CAACT,MAAM,EAAEC,IAAI,CAAC,GAAGD,MAAM,CAACI,GAAG,CAAC,MAAM,CAAC,CAAC;EACtF,MAAMM,UAAU,GAAGV,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEC,CAAC,KAAK,GAAG,CAACC,MAAM,CAACN,MAAM,CAACK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;EAEnE,OAAO,CACLE,SAAS,CAACd,MAAM,EAAEO,MAAM,CAAC,EACzBO,SAAS,CAACJ,UAAU,EAAEH,MAAM,CAAC,EAC7B,GAAGN,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKQ,SAAS,CAACR,GAAG,EAAEC,MAAM,CAAC,CAAC,CAC7C,CAACQ,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAASN,eAAeA,CAACT,MAAyB,EAAEC,IAAyB,EAAY;EACvF,OAAOD,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEK,KAAK,KAAKC,cAAc,CAACjB,MAAM,EAAEC,IAAI,EAAEe,KAAK,CAAC,CAAC;AACtE;AAEA,SAASC,cAAcA,CACrBjB,MAAyB,EACzBC,IAAyB,EACzBe,KAAa,EACL;EACR,OAAOE,IAAI,CAACC,GAAG,CAACnB,MAAM,CAACgB,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,EAAE,GAAGF,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACU,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,CAAC,CAAC;AAC5F;AAEA,SAASW,SAASA,CAACR,GAAsB,EAAEC,MAAyB,EAAU;EAC5E,MAAMa,WAAW,GAAGd,GAAG,CAACF,GAAG,CAAC,CAACiB,IAAI,EAAEL,KAAK,KAAKK,IAAI,CAACC,MAAM,CAACf,MAAM,CAACS,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;EAC7E,OAAO,KAAKI,WAAW,CAACL,IAAI,CAAC,KAAK,CAAC,IAAI;AACzC;AAEA,SAASV,iBAAiBA,CAACgB,IAAY,EAAU;EAC/C,OAAOA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AAC3D","ignoreList":[]}
|
package/dist/esm/block.mjs
CHANGED
package/dist/esm/block.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.mjs","names":["prefixLines","horizontalRule","heading","text","level","repeat","blockquote","content","codeBlock","list","items","map","item","join","orderedList","index"],"sources":["../../src/block.ts"],"sourcesContent":["import { prefixLines } from './utils';\n\n/**\n * Create a horizontal rule block.\n *\n * Markdown: `---`\n */\nexport const horizontalRule = '
|
|
1
|
+
{"version":3,"file":"block.mjs","names":["prefixLines","horizontalRule","heading","text","level","repeat","blockquote","content","codeBlock","list","items","map","item","join","orderedList","index"],"sources":["../../src/block.ts"],"sourcesContent":["import { prefixLines } from './utils';\n\n/**\n * Create a horizontal rule block.\n *\n * Markdown: `---`\n */\nexport const horizontalRule = '---';\n\n/**\n * Create a heading block.\n * Markdown: `# Heading`\n *\n * @param text - The text of the heading.\n * @param level - The level of the heading (defaults to 1).\n */\nexport function heading(text: string, level: number = 1): string {\n return `${'#'.repeat(level)} ${text}`;\n}\n\n/**\n * Create a blockquote block.\n *\n * Markdown:\n * ```\n * > Content\n * > Content\n * ```\n *\n * @param text - The content of the blockquote.\n */\nexport function blockquote(content: string): string {\n return prefixLines(content, '> ');\n}\n\n/**\n * Create a code block.\n *\n * Markdown:\n * ````\n * ```\n * Content\n * ```\n * ````\n *\n * @param content - The content of the code block.\n */\nexport function codeBlock(content: string): string {\n return `\\`\\`\\`\\n${content}\\n\\`\\`\\``;\n}\n\n/**\n * Create an unordered list block.\n *\n * Markdown:\n * ```\n * - Item\n * - Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function list(items: readonly string[]): string {\n return items.map((item) => `- ${item}`).join('\\n');\n}\n\n/**\n * Create an ordered list block.\n *\n * Markdown:\n * ```\n * 1. Item\n * 2. Item\n * ```\n *\n * @param items - The items of the list.\n */\nexport function orderedList(items: readonly string[]): string {\n return items.map((item, index) => `${index + 1}. ${item}`).join('\\n');\n}\n"],"mappings":"SAASA,WAAW;AAOpB,OAAO,MAAMC,cAAc,GAAG,KAAK;AASnC,OAAO,SAASC,OAAOA,CAACC,IAAY,EAAEC,KAAa,GAAG,CAAC,EAAU;EAC/D,OAAO,GAAG,GAAG,CAACC,MAAM,CAACD,KAAK,CAAC,IAAID,IAAI,EAAE;AACvC;AAaA,OAAO,SAASG,UAAUA,CAACC,OAAe,EAAU;EAClD,OAAOP,WAAW,CAACO,OAAO,EAAE,IAAI,CAAC;AACnC;AAcA,OAAO,SAASC,SAASA,CAACD,OAAe,EAAU;EACjD,OAAO,WAAWA,OAAO,UAAU;AACrC;AAaA,OAAO,SAASE,IAAIA,CAACC,KAAwB,EAAU;EACrD,OAAOA,KAAK,CAACC,GAAG,CAAEC,IAAI,IAAK,KAAKA,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACpD;AAaA,OAAO,SAASC,WAAWA,CAACJ,KAAwB,EAAU;EAC5D,OAAOA,KAAK,CAACC,GAAG,CAAC,CAACC,IAAI,EAAEG,KAAK,KAAK,GAAGA,KAAK,GAAG,CAAC,KAAKH,IAAI,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACvE","ignoreList":[]}
|
package/dist/esm/html.mjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export const lineBreak = '<br/>';
|
|
2
|
+
export function disclosure(title, content, options) {
|
|
3
|
+
const headerHack = title.startsWith('#') ? '\n\n' : '';
|
|
4
|
+
return `<details${options?.open ? ' open' : ''}>
|
|
5
|
+
<summary>${headerHack}${title}${headerHack}</summary>
|
|
6
|
+
\n${content}\n
|
|
7
|
+
</details>`;
|
|
3
8
|
}
|
|
4
9
|
//# sourceMappingURL=html.mjs.map
|
package/dist/esm/html.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.mjs","names":["disclosure","title","content"],"sources":["../../src/html.ts"],"sourcesContent":["/**\n * Create a disclosure block.\n *\n * Markdown/Html:\n * ```\n * <details>\n * <summary>Title</summary>\n * Content\n * </details>\n * ```\n *\n * @param title - The title of the disclosure.\n * @param content - The content of the disclosure.\n */\nexport function disclosure(title: string, content: string): string {\n return `<details
|
|
1
|
+
{"version":3,"file":"html.mjs","names":["lineBreak","disclosure","title","content","options","headerHack","startsWith","open"],"sources":["../../src/html.ts"],"sourcesContent":["/**\n * Create a line break.\n *\n * Markdown/Html:: `<br/>`\n */\nexport const lineBreak = '<br/>';\n\n/**\n * Options for the `disclosure` block.\n */\nexport type DisclosureOptions = {\n /**\n * Whether the disclosure block should be open by default.\n */\n open?: boolean;\n};\n\n/**\n * Create a disclosure block.\n *\n * Markdown/Html:\n * ```\n * <details>\n * <summary>Title</summary>\n * Content\n * </details>\n * ```\n *\n * @param title - The title of the disclosure.\n * @param content - The content of the disclosure.\n * @param options - The options for the disclosure.\n */\nexport function disclosure(title: string, content: string, options?: DisclosureOptions): string {\n // Add extra with lines to render header properly. New line should not be added for regular text\n // as it messes up the formatting.\n const headerHack = title.startsWith('#') ? '\\n\\n' : '';\n\n // The extra new lines in <summary> and <details> are required for proper rendering in GitHub.\n // See https://gist.github.com/scmx/eca72d44afee0113ceb0349dd54a84a2\n return `<details${options?.open ? ' open' : ''}>\n<summary>${headerHack}${title}${headerHack}</summary>\n\\n${content}\\n \n</details>`;\n}\n"],"mappings":"AAKA,OAAO,MAAMA,SAAS,GAAG,OAAO;AA2BhC,OAAO,SAASC,UAAUA,CAACC,KAAa,EAAEC,OAAe,EAAEC,OAA2B,EAAU;EAG9F,MAAMC,UAAU,GAAGH,KAAK,CAACI,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,EAAE;EAItD,OAAO,WAAWF,OAAO,EAAEG,IAAI,GAAG,OAAO,GAAG,EAAE;AAChD,WAAWF,UAAU,GAAGH,KAAK,GAAGG,UAAU;AAC1C,IAAIF,OAAO;AACX,WAAW;AACX","ignoreList":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { joinBlocks } from "./join
|
|
1
|
+
export { joinBlocks, joinLines } from "./join.mjs";
|
|
2
2
|
export { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from "./block.mjs";
|
|
3
|
-
export {
|
|
3
|
+
export { code, italic, bold, link, image } from "./inline.mjs";
|
|
4
4
|
export { table } from "./table.mjs";
|
|
5
|
-
export { disclosure } from "./html.mjs";
|
|
5
|
+
export { lineBreak, disclosure } from "./html.mjs";
|
|
6
6
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["joinBlocks","horizontalRule","heading","blockquote","orderedList","list","codeBlock","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["joinBlocks","joinLines","horizontalRule","heading","blockquote","orderedList","list","codeBlock","code","italic","bold","link","image","table","lineBreak","disclosure"],"sources":["../../src/index.ts"],"sourcesContent":["export { joinBlocks, joinLines } from './join';\nexport { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from './block';\nexport { code, italic, bold, link, image } from './inline';\nexport { table } from './table';\nexport { lineBreak, disclosure } from './html';\n\nexport type { TableOptions } from './table';\nexport type { DisclosureOptions } from './html';\n"],"mappings":"SAASA,UAAU,EAAEC,SAAS;AAAA,SACrBC,cAAc,EAAEC,OAAO,EAAEC,UAAU,EAAEC,WAAW,EAAEC,IAAI,EAAEC,SAAS;AAAA,SACjEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK;AAAA,SAC/BC,KAAK;AAAA,SACLC,SAAS,EAAEC,UAAU","ignoreList":[]}
|
package/dist/esm/inline.mjs
CHANGED
package/dist/esm/inline.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.mjs","names":["
|
|
1
|
+
{"version":3,"file":"inline.mjs","names":["italic","text","bold","code","link","url","image"],"sources":["../../src/inline.ts"],"sourcesContent":["/**\n * Create an italic text.\n *\n * Markdown: `*text*`\n *\n * @param text - The text to be italicized.\n */\nexport function italic(text: string): string {\n return `*${text}*`;\n}\n\n/**\n * Create a bold text.\n *\n * Markdown: `**text**`\n *\n * @param text - The text to be bolded.\n */\nexport function bold(text: string): string {\n return `**${text}**`;\n}\n\n/**\n * Create a code text.\n *\n * Markdown: `\\`text\\``\n *\n * @param text - The text to be marked as code.\n */\nexport function code(text: string): string {\n return `\\`${text}\\``;\n}\n\n/**\n * Create a link or autolink span.\n *\n * Markdown:\n * - `[text](url)` link when `text` is provided\n * - `<url>` autolink when `text` is not provided\n *\n * @param url - The URL to be linked.\n * @param text - The title for the link (optional).\n */\nexport function link(url: string, text?: string): string {\n return text ? `[${text}](${url})` : `<${url}>`;\n}\n\n/**\n * Create an image text.\n *\n * Markdown: ``\n *\n * @param url - The URL of the image.\n * @param text - The description for the image (optional).\n */\nexport function image(url: string, text?: string): string {\n return ``;\n}\n"],"mappings":"AAOA,OAAO,SAASA,MAAMA,CAACC,IAAY,EAAU;EAC3C,OAAO,IAAIA,IAAI,GAAG;AACpB;AASA,OAAO,SAASC,IAAIA,CAACD,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AASA,OAAO,SAASE,IAAIA,CAACF,IAAY,EAAU;EACzC,OAAO,KAAKA,IAAI,IAAI;AACtB;AAYA,OAAO,SAASG,IAAIA,CAACC,GAAW,EAAEJ,IAAa,EAAU;EACvD,OAAOA,IAAI,GAAG,IAAIA,IAAI,KAAKI,GAAG,GAAG,GAAG,IAAIA,GAAG,GAAG;AAChD;AAUA,OAAO,SAASC,KAAKA,CAACD,GAAW,EAAEJ,IAAa,EAAU;EACxD,OAAO,KAAKA,IAAI,IAAI,EAAE,KAAKI,GAAG,GAAG;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { lineBreak } from "./html.mjs";
|
|
2
|
+
export function joinBlocks(blocks) {
|
|
3
|
+
return blocks.filter(Boolean).map(trimBlock).join('\n\n');
|
|
4
|
+
}
|
|
5
|
+
export function joinLines(lines) {
|
|
6
|
+
return lines.filter(Boolean).join(lineBreak);
|
|
7
|
+
}
|
|
8
|
+
function trimBlock(block) {
|
|
9
|
+
return block.replace(/^\n+|\n+$/g, '');
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=join.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join.mjs","names":["lineBreak","joinBlocks","blocks","filter","Boolean","map","trimBlock","join","joinLines","lines","block","replace"],"sources":["../../src/join.ts"],"sourcesContent":["import { lineBreak } from './html';\n\n/**\n * Join blocks of text into a single markdown document (string).\n *\n * @param blocks - The blocks of text to join.\n * @returns Markdown document string.\n */\nexport function joinBlocks(blocks: readonly string[]): string {\n return blocks.filter(Boolean).map(trimBlock).join('\\n\\n');\n}\n\n/**\n * Join lines of text into a single paragraph string with line breaks.\n *\n * @param lines - The lines of text to join.\n * @returns Paragraph string.\n */\nexport function joinLines(lines: string[]) {\n return lines.filter(Boolean).join(lineBreak);\n}\n\nfunction trimBlock(block: string): string {\n return block.replace(/^\\n+|\\n+$/g, '');\n}\n"],"mappings":"SAASA,SAAS;AAQlB,OAAO,SAASC,UAAUA,CAACC,MAAyB,EAAU;EAC5D,OAAOA,MAAM,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,GAAG,CAACC,SAAS,CAAC,CAACC,IAAI,CAAC,MAAM,CAAC;AAC3D;AAQA,OAAO,SAASC,SAASA,CAACC,KAAe,EAAE;EACzC,OAAOA,KAAK,CAACN,MAAM,CAACC,OAAO,CAAC,CAACG,IAAI,CAACP,SAAS,CAAC;AAC9C;AAEA,SAASM,SAASA,CAACI,KAAa,EAAU;EACxC,OAAOA,KAAK,CAACC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;AACxC","ignoreList":[]}
|
package/dist/esm/table.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.mjs","names":["table","header","rows","options","length","map","escapeCellContent","row","widths","compact","getColumnsWidth","separators","_","i","repeat","renderRow","join","index","getColumnWidth","Math","max","paddedCells","cell","padEnd","replace"],"sources":["../../src/table.ts"],"sourcesContent":["export type TableOptions = {\n compact: boolean;\n};\n\nexport function table(header: string[]
|
|
1
|
+
{"version":3,"file":"table.mjs","names":["table","header","rows","options","length","map","escapeCellContent","row","widths","compact","getColumnsWidth","separators","_","i","repeat","renderRow","join","index","getColumnWidth","Math","max","paddedCells","cell","padEnd","replace"],"sources":["../../src/table.ts"],"sourcesContent":["export type TableOptions = {\n compact: boolean;\n};\n\nexport function table(\n header: readonly string[],\n rows: readonly string[][],\n options?: TableOptions,\n): string {\n if (header.length === 0) {\n return '';\n }\n\n // Escape the header and rows content\n header = header.map(escapeCellContent);\n rows = rows.map((row) => row.map(escapeCellContent));\n\n const widths = !options?.compact ? getColumnsWidth(header, rows) : header.map(() => 1);\n const separators = header.map((_, i) => '-'.repeat(widths[i] ?? 0));\n\n return [\n renderRow(header, widths),\n renderRow(separators, widths),\n ...rows.map((row) => renderRow(row, widths)),\n ].join('\\n');\n}\n\nfunction getColumnsWidth(header: readonly string[], rows: readonly string[][]): number[] {\n return header.map((_, index) => getColumnWidth(header, rows, index));\n}\n\nfunction getColumnWidth(\n header: readonly string[],\n rows: readonly string[][],\n index: number,\n): number {\n return Math.max(header[index]?.length ?? 0, ...rows.map((row) => row[index]?.length ?? 0));\n}\n\nfunction renderRow(row: readonly string[], widths: readonly number[]): string {\n const paddedCells = row.map((cell, index) => cell.padEnd(widths[index] ?? 0));\n return `| ${paddedCells.join(' | ')} |`;\n}\n\nfunction escapeCellContent(cell: string): string {\n return cell.replace(/\\|/g, '\\\\|').replace(/\\n/g, '<br/>');\n}\n"],"mappings":"AAIA,OAAO,SAASA,KAAKA,CACnBC,MAAyB,EACzBC,IAAyB,EACzBC,OAAsB,EACd;EACR,IAAIF,MAAM,CAACG,MAAM,KAAK,CAAC,EAAE;IACvB,OAAO,EAAE;EACX;EAGAH,MAAM,GAAGA,MAAM,CAACI,GAAG,CAACC,iBAAiB,CAAC;EACtCJ,IAAI,GAAGA,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACF,GAAG,CAACC,iBAAiB,CAAC,CAAC;EAEpD,MAAME,MAAM,GAAG,CAACL,OAAO,EAAEM,OAAO,GAAGC,eAAe,CAACT,MAAM,EAAEC,IAAI,CAAC,GAAGD,MAAM,CAACI,GAAG,CAAC,MAAM,CAAC,CAAC;EACtF,MAAMM,UAAU,GAAGV,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEC,CAAC,KAAK,GAAG,CAACC,MAAM,CAACN,MAAM,CAACK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;EAEnE,OAAO,CACLE,SAAS,CAACd,MAAM,EAAEO,MAAM,CAAC,EACzBO,SAAS,CAACJ,UAAU,EAAEH,MAAM,CAAC,EAC7B,GAAGN,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKQ,SAAS,CAACR,GAAG,EAAEC,MAAM,CAAC,CAAC,CAC7C,CAACQ,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAASN,eAAeA,CAACT,MAAyB,EAAEC,IAAyB,EAAY;EACvF,OAAOD,MAAM,CAACI,GAAG,CAAC,CAACO,CAAC,EAAEK,KAAK,KAAKC,cAAc,CAACjB,MAAM,EAAEC,IAAI,EAAEe,KAAK,CAAC,CAAC;AACtE;AAEA,SAASC,cAAcA,CACrBjB,MAAyB,EACzBC,IAAyB,EACzBe,KAAa,EACL;EACR,OAAOE,IAAI,CAACC,GAAG,CAACnB,MAAM,CAACgB,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,EAAE,GAAGF,IAAI,CAACG,GAAG,CAAEE,GAAG,IAAKA,GAAG,CAACU,KAAK,CAAC,EAAEb,MAAM,IAAI,CAAC,CAAC,CAAC;AAC5F;AAEA,SAASW,SAASA,CAACR,GAAsB,EAAEC,MAAyB,EAAU;EAC5E,MAAMa,WAAW,GAAGd,GAAG,CAACF,GAAG,CAAC,CAACiB,IAAI,EAAEL,KAAK,KAAKK,IAAI,CAACC,MAAM,CAACf,MAAM,CAACS,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;EAC7E,OAAO,KAAKI,WAAW,CAACL,IAAI,CAAC,KAAK,CAAC,IAAI;AACzC;AAEA,SAASV,iBAAiBA,CAACgB,IAAY,EAAU;EAC/C,OAAOA,IAAI,CAACE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AAC3D","ignoreList":[]}
|
package/dist/types/block.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Markdown: `---`
|
|
5
5
|
*/
|
|
6
|
-
export declare const horizontalRule = "
|
|
6
|
+
export declare const horizontalRule = "---";
|
|
7
7
|
/**
|
|
8
8
|
* Create a heading block.
|
|
9
9
|
* Markdown: `# Heading`
|
|
@@ -48,7 +48,7 @@ export declare function codeBlock(content: string): string;
|
|
|
48
48
|
*
|
|
49
49
|
* @param items - The items of the list.
|
|
50
50
|
*/
|
|
51
|
-
export declare function list(items: string[]): string;
|
|
51
|
+
export declare function list(items: readonly string[]): string;
|
|
52
52
|
/**
|
|
53
53
|
* Create an ordered list block.
|
|
54
54
|
*
|
|
@@ -60,4 +60,4 @@ export declare function list(items: string[]): string;
|
|
|
60
60
|
*
|
|
61
61
|
* @param items - The items of the list.
|
|
62
62
|
*/
|
|
63
|
-
export declare function orderedList(items: string[]): string;
|
|
63
|
+
export declare function orderedList(items: readonly string[]): string;
|
package/dist/types/html.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a line break.
|
|
3
|
+
*
|
|
4
|
+
* Markdown/Html:: `<br/>`
|
|
5
|
+
*/
|
|
6
|
+
export declare const lineBreak = "<br/>";
|
|
7
|
+
/**
|
|
8
|
+
* Options for the `disclosure` block.
|
|
9
|
+
*/
|
|
10
|
+
export type DisclosureOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Whether the disclosure block should be open by default.
|
|
13
|
+
*/
|
|
14
|
+
open?: boolean;
|
|
15
|
+
};
|
|
1
16
|
/**
|
|
2
17
|
* Create a disclosure block.
|
|
3
18
|
*
|
|
@@ -11,5 +26,6 @@
|
|
|
11
26
|
*
|
|
12
27
|
* @param title - The title of the disclosure.
|
|
13
28
|
* @param content - The content of the disclosure.
|
|
29
|
+
* @param options - The options for the disclosure.
|
|
14
30
|
*/
|
|
15
|
-
export declare function disclosure(title: string, content: string): string;
|
|
31
|
+
export declare function disclosure(title: string, content: string, options?: DisclosureOptions): string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { joinBlocks } from './join
|
|
1
|
+
export { joinBlocks, joinLines } from './join';
|
|
2
2
|
export { horizontalRule, heading, blockquote, orderedList, list, codeBlock } from './block';
|
|
3
|
-
export {
|
|
3
|
+
export { code, italic, bold, link, image } from './inline';
|
|
4
4
|
export { table } from './table';
|
|
5
|
-
export { disclosure } from './html';
|
|
5
|
+
export { lineBreak, disclosure } from './html';
|
|
6
6
|
export type { TableOptions } from './table';
|
|
7
|
+
export type { DisclosureOptions } from './html';
|
package/dist/types/inline.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Join blocks of text into a single markdown document (string).
|
|
3
|
+
*
|
|
4
|
+
* @param blocks - The blocks of text to join.
|
|
5
|
+
* @returns Markdown document string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function joinBlocks(blocks: readonly string[]): string;
|
|
8
|
+
/**
|
|
9
|
+
* Join lines of text into a single paragraph string with line breaks.
|
|
10
|
+
*
|
|
11
|
+
* @param lines - The lines of text to join.
|
|
12
|
+
* @returns Paragraph string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function joinLines(lines: string[]): string;
|
package/dist/types/table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type TableOptions = {
|
|
2
2
|
compact: boolean;
|
|
3
3
|
};
|
|
4
|
-
export declare function table(header: string[], rows: string[][], options?: TableOptions): string;
|
|
4
|
+
export declare function table(header: readonly string[], rows: readonly string[][], options?: TableOptions): string;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join-blocks.js","names":["joinBlocks","blocks","map","trimBlock","join","block","replace"],"sources":["../../src/join-blocks.ts"],"sourcesContent":["/**\n * Join blocks of text into a single markdown document (string).\n *\n * @param blocks - The blocks of text to join.\n * @returns Markdown document string.\n */\nexport function joinBlocks(blocks: string[]): string {\n return blocks.map(trimBlock).join('\\n\\n');\n}\n\nfunction trimBlock(block: string): string {\n return block.replace(/^\\n+|\\n+$/g, '');\n}\n"],"mappings":";;;AAMO,SAASA,UAAUA,CAACC,MAAgB,EAAU;EACnD,OAAOA,MAAM,CAACC,GAAG,CAACC,SAAS,CAAC,CAACC,IAAI,CAAC,MAAM,CAAC;AAC3C;AAEA,SAASD,SAASA,CAACE,KAAa,EAAU;EACxC,OAAOA,KAAK,CAACC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;AACxC","ignoreList":[]}
|
package/dist/esm/join-blocks.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join-blocks.mjs","names":["joinBlocks","blocks","map","trimBlock","join","block","replace"],"sources":["../../src/join-blocks.ts"],"sourcesContent":["/**\n * Join blocks of text into a single markdown document (string).\n *\n * @param blocks - The blocks of text to join.\n * @returns Markdown document string.\n */\nexport function joinBlocks(blocks: string[]): string {\n return blocks.map(trimBlock).join('\\n\\n');\n}\n\nfunction trimBlock(block: string): string {\n return block.replace(/^\\n+|\\n+$/g, '');\n}\n"],"mappings":"AAMA,OAAO,SAASA,UAAUA,CAACC,MAAgB,EAAU;EACnD,OAAOA,MAAM,CAACC,GAAG,CAACC,SAAS,CAAC,CAACC,IAAI,CAAC,MAAM,CAAC;AAC3C;AAEA,SAASD,SAASA,CAACE,KAAa,EAAU;EACxC,OAAOA,KAAK,CAACC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;AACxC","ignoreList":[]}
|